/**
 * System 对象
 *
 * @package js.lang
 * @author: DSONet (dsonet@msn.com)
 * @version $Id: Exception.js 35 2008-03-02 17:01:34Z dsonet $
 */
/**
 * 
 *
 */
function Exception (number, message, cause)
{
	this.number = 0x10000 + number;
	this.message = message;
	this.cause = cause;
}

var $p = Exception.prototype;

$p.name = "Exception";

$p.getName = function ()
{
	return this.name;
}
$p.getMessage = function ()
{
	return this.message;
}

$p.getCause = function ()
{
	return this.cause;
}

$p.toString = function()
{
	return this.getName()	+ ":" + this.getMessage();
}

$p.printStackTrace = function()
{
	var s = this.toString(), e = this.cause;
	while(e != null)
	{
		s += "\r\n\tat " + e.toString();
		e = e.cause;
	}
	(arguments.length > 0 &&
		typeof(arguments[0].println) == "function") ?
		arguments[0].println(s) :
			$log.trace(s + "\r\n");
}

function ArgumentException ()
{
	Exception.apply(this, arguments.length > 0 ? arguments : ["Arguments Illegal."]);
}

$p = Type.extend(ArgumentException, Exception).prototype;

$p.name = "ArgumentException";

function RuntimeException ()
{
	Exception.apply(this, arguments.length > 0 ? arguments : ["Runtime Exception."]);
}

$p = Type.extend(RuntimeException, Exception).prototype;

$p.name = "RuntimeException";

function NotSupportException ()
{
	Exception.apply(this, arguments.length > 0 ? arguments : ["System don't support!"]);
}

$p = Type.extend(NotSupportException, Exception).prototype;

$p.name = "NotSupportException";

$p = null;
